package Buff_;

import org.junit.Test;

import java.io.*;

public class Buff0_ {
    public static void main(String[] args) {

    }
    @Test
    public void buff(){
        String src="d:\\d1ae-icuacsa3949374.jpg";
        String dest="d:\\next5.jpg";
        BufferedInputStream bufferedInputStream=null;
        BufferedOutputStream bufferedOutputStream=null;
        try {
            bufferedInputStream=new BufferedInputStream(new FileInputStream(src));
            bufferedOutputStream=new BufferedOutputStream(new FileOutputStream(dest));
            int n=0;
            byte[] b=new byte[1024];
            while((n=bufferedInputStream.read(b))!=-1){
                bufferedOutputStream.write(b,0,n);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }try {
        if (bufferedInputStream!=null){
            bufferedInputStream.close();
        }
        if(bufferedOutputStream!=null){
            bufferedOutputStream.close();
        }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
